using System.Collections.Generic;
using AllInOnePluginBL.SiteInfoScrappers;
using PluginDB;
using AllInOnePluginBL.Helpers;

namespace AllInOnePluginBL.Rules
{
    /// <summary>
    /// Summary description for ExtractSeriesNameRule
    /// </summary>
    public class ExtractSeriesNameRule : IRule
    {
        public void ApplyRule(PluginVideoInfo pluginVideoInfo)
        {
            //If the movie is not of series type then exit
            if (!pluginVideoInfo.IsTVShow) return;

            var pluginDBHandler = PluginDBHandler.Instance;
            if (!pluginDBHandler.IsSeriesExists(pluginVideoInfo.TVShowInformation.SeriesName))
            {
                pluginVideoInfo.TVShowInformation.TVDBInformationItem = TheTVDBScraper.GetTVDBInformation(pluginVideoInfo.TVShowInformation.SeriesName);
            }

            pluginVideoInfo.Categories = new List<string>
                                             {
                                                 pluginVideoInfo.TVShowInformation.SeriesName
                                             };
        }
    }

}